home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1297 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: uni-erlangen.de!winx03!news
  2. From: Volker Braun <vrbraun@cip.physik.uni-wuerzburg.de>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: void pointers
  5. Date: Wed, 10 Jan 1996 09:08:42 +0100
  6. Organization: University of Wuerzburg, Germany
  7. Message-ID: <30F3740A.A06@cip.physik.uni-wuerzburg.de>
  8. References: <Pine.SUN.3.91.960105113409.18158A-100000@phoenix.acms.arizona.edu> <DKx55F.1D4@news.zippo.com>
  9. NNTP-Posting-Host: wpax11.physik.uni-wuerzburg.de
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b4 (X11; I; HP-UX A.09.01 9000/705)
  14.  
  15. Jim McFarland wrote:
  16. > Kenton White <jwhite@phoenix.acms.arizona.edu> wrote:
  17. > >
  18. > >
  19. > >I am trying to create a class that stores pointers to other classes in an
  20. > >array of void pointers.  Since void pointers cannot be dereferenced, is
  21. > >there any way to cast the void pointer to a non-void pointer and then
  22. > >dereference?
  23. > >
  24. > Since you are trying to create a container class, what you need to do is
  25. > to use polmorphism and avoid using void pointers all together.
  26.  
  27. You schould think about using templates for your container class. With
  28. templates, you can program type-safe containers.
  29.